﻿//Global Variables
var serverNumberDecimalSeparator;

//URL OBJECT: RELATIVE URL RESOLVER
var __relativeURL;

Url = function () { }

Url.prototype =
{
    resolve: function (relative) {
        var resolved = relative;
        if (relative.charAt(0) == '~') resolved = __relativeURL + relative.substring(2);
        return resolved;
    }
}

$Url = new Url();
//

//Global Error Handler
function handleGlobalError(xhr, status, err) {
    if (xhr != null) {
        alert(xhr.responseText);
    }
    else {
        alert(text);
    }
}
//

function getClientDecimalSeparator() {
    return (1 / 2).toString().substr(1, 1);
}

function getServerDecimalSeparator() {
    return serverNumberDecimalSeparator;
}

function convertToClientDecimalNumber(number) {
    return number.toString().replace(getServerDecimalSeparator(), getClientDecimalSeparator());
}

function convertToServerDecimalNumber(number) {
    return number.toString().replace(getClientDecimalSeparator(), getServerDecimalSeparator());
}

//

function getDateFromMSJSONDate(msJSONDate) {
    return new Date(parseInt(msJSONDate.replace("/Date(", "").replace(")/", ""), 10));
}

